import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;

import org.apache.commons.io.FileUtils;

/**
 *  备份Git差异文件
 * @author Lenovo
 *
 */
public class CopyFiles {

	public static void main(String[] args) throws IOException {
		//git diff   --name-status > d:\temp\changes.txt 列出本地变更文件
		String fileList = "D:\\temp\\changes.txt"; 
		String srcdir = "D:\\hbworkspace\\apiwork\\api-push-center";
		String destDir = "D:\\code_back\\华为实况窗\\完整清单";
		BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(fileList), "UTF-8"));
		String contentLine = null;
		while ((contentLine = br.readLine()) != null) {
			String[] arr = contentLine.split("	"); 
			String tmp = arr[1] ; 
			String fileName = tmp.substring(tmp.lastIndexOf("/") + 1 ) ;
			System.out.println(fileName);
			FileUtils.copyFile(new File(srcdir + "\\" + arr[1]), new File(destDir + "/" + fileName) );
		}
	}
}
